/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package View;

import java.util.*;
import java.util.regex.*;

/**
 *
 * @author admin-pc
 */
public abstract class View {

    public static boolean test(String testString) {
        Pattern p = Pattern.compile("^[_a-zA-Z0-9\\s]+$");
        Matcher m = p.matcher(testString);
        return m.matches();
    }

    public static int readPressSymbolInt() {
        Scanner scanner = new Scanner(System.in);
        String idString = scanner.nextLine();
        int id = Integer.parseInt(idString);
        return id;
    }

    public static String readPressSymbolStr() {
        Scanner scanner = new Scanner(System.in);
        String id = scanner.nextLine();
        if (test(id)) {
            return id;
        }
        else {
            System.out.println("\nВведите корректные данные");

        }
        return readPressSymbolStr();

    }

}
